<?php
/**
 * 个人中心
 * Enter description here ...
 * @author gjb
 *
 */
class CenterController extends FrontController{
	public $defaultAction = 'ticket';
	public function beforeAction($action) {
		$url = Yii::app()->request->urlReferrer ? Yii::app()->request->urlReferrer : $this->createUrl('/provide/index');
		if (empty(Yii::app()->adminUser->id)) {
			$this->redirect($url);
		} else if (Yii::app()->adminUser->role != AdminUser::ROLE_MEMBER) {
			$this->redirect($url);
		}
		return true;
	}
	/**
	 * changePwdAction 修改密码
	 */

    public function actions() {
    	$criteria = array(
    		'condition' => 'worker_id = :uid',
    		'params' => array(
    			':uid' => Yii::app()->adminUser->id,
    		),
    	);
		return array(
			'changepwd' => array(
				'class' => 'application.components.actions.front.ChangePwdAction',
				'view' => 'changepwd',
			),
			'ticket' => array(
				'class' => 'application.components.actions.front.ListAction',
				'modelName' => 'OrderTicket',
				'view' => 'ticket',
				'criteria' => $criteria,
			),
			'travel' => array(
				'class' => 'application.components.actions.front.ListAction',
				'modelName' => 'OrderTravel',
				'view' => 'list',
			    'data' => array(
			        'title' => '旅游订单',
			    ),
				'criteria' => $criteria,
			),
			'scenic' => array(
				'class' => 'application.components.actions.front.ListAction',
				'modelName' => 'OrderScenic',
				'view' => 'compnay_list',
				'data' => array(
			        'title' => '景区订单',
			    ),
				'criteria' => $criteria,
			),
			'native' => array(
				'class' => 'application.components.actions.front.ListAction',
				'modelName' => 'OrderNative',
				'view' => 'list',
			    'data' => array(
			        'title' => '土特产订单',
			    ),
				'criteria' => $criteria,
			),
			'hotel' => array(
				'class' => 'application.components.actions.front.ListAction',
				'modelName' => 'OrderHotel',
				'view' => 'compnay_list',
			    'data' => array(
			        'title' => '酒店订单',
			    ),
				'criteria' => $criteria,
			),
			'cancel' => array(
				'class' => 'application.components.actions.front.StateAction',
				'modelName' => 'Order',
				'nextState' => 'ST_CANCELED',
				'stateHandle' => 'stateHandle',
			),
			'view' => array(
				'class' => 'application.components.actions.front.ViewAction',
			    'modelName' => 'Order',
			    'view' => 'order_view',
			),
			'pay' => 'application.components.actions.front.PayAction'
		);
    }
}

?>